#include "anti_theft.h"
#include "../lcd/lcd.h"
#include "../button/button.h"
#include "../buzzer/buzzer.h"

uchar anti_theft_flag = 0;

void AntiTheftSystem(uchar flag)
{
	if(flag == 0) return;
	else if(flag == 1)
	{
		anti = 1;
			
		if(anti == 1)
		{
			Lcd1602ClearScreen();
			Lcd1602WriteString(1,1,"-!!!WARNING!!!- ");
			Lcd1602WriteString(2,1," Someone stole 3");
			/*
			while(anti)
			{
				//buzzer = ~buzzer;
				//Delay(100);				
			}
			*/
			Buzzer(1);
			LED = 1;

			while(1)
			{
				if(anti == 0) LED = 0;
				else LED = 1;
				if(HomeCheck() == 1)
				{
					Buzzer(0);
					return;
				}
			}	
			//Lcd1602ClearScreen();
		}
	}	
}